package de.slothsoft.android.util;

import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;

public final class WebUtil {

    public static void openUrl(Context context, String url) {
	Intent i = new Intent(Intent.ACTION_VIEW);
	i.setData(Uri.parse(url));
	context.startActivity(i);
    }

    public static boolean isOnline(Context context) {
	ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
	NetworkInfo netInfo = cm.getActiveNetworkInfo();
	if (netInfo != null && netInfo.isConnectedOrConnecting())
	    return true;
	return false;
    }

    private WebUtil() {
	// hide me
    }
}
